//
//  MGMarqueeLabel.h
//  Live
//
//  Created by 胡超 on 2021/3/7.
//  Copyright © 2021 DLive. All rights reserved.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSInteger, MGMarqueeType) {
    /** 左右往返*/
    MGMarqueeTypeHorizontalRoundTrip,
    /** 往左循环滚动*/
    MGMarqueeTypeHorizontalLeft,
    /** 往右循环滚动*/
    MGMarqueeTypeHorizontalRight,
    /** 往上滚动*/
    MGMarqueeTypeVerticalUp,
    /** 往下滚动*/
    MGMarqueeTypeVerticalDown,
};

@interface MGMarqueeLabel : UIView

/** MGMarqueeTypeHorizontalRoundTrip类型，仅支持1条文本*/
@property (nonatomic,copy) NSArray <NSString *> *textList;
@property (nonatomic,copy) NSArray <NSAttributedString *> *attributedTextList;

@property (nonatomic,strong) UIFont *font;
@property (nonatomic,strong) UIColor *textColor;

@property (nonatomic,assign) CGFloat textSpace; // default is 20.0
@property (nonatomic,assign) CGFloat speed;

/** MGMarqueeTypeVerticalUp和MGMarqueeTypeVerticalDown类型下有效，YES为整体一条翻滚，NO为平滑移动*/
@property (nonatomic,assign) BOOL verticalFlip;

- (instancetype)initWithFrame:(CGRect)frame type:(MGMarqueeType)type;

@end

@interface MGMarqueeRoundTripLabel : UIView

@property (nonatomic,copy) NSString *text;
@property (nonatomic,copy) NSAttributedString *attributedText;

@property (nonatomic,strong) UIFont *font;
@property (nonatomic,strong) UIColor *textColor;

@property (nonatomic,assign) CGFloat speed; // default 30.0, 值越大，滚动越快
@property (nonatomic,assign) NSTimeInterval stayDuration; // 停留时间，默认2秒

@property (nonatomic,assign) BOOL autoUpdateAnimation; // 自动更新动画，文字会经常变更的时候需要开启该属性。default NO

- (void)startMarquee;

// 当autoUpdateAnimation设为YES时，需要手动清理。否则不能正常dealloc
- (void)clean;

@end

NS_ASSUME_NONNULL_END
